package com.ruoyi;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;

import javax.annotation.Resource;

@Slf4j
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}, scanBasePackages = {"com.ruoyi"})
public class RuoYiApplication implements CommandLineRunner {
    @Resource
    private Environment environment;

    public static void main(String[] args) {
        SpringApplication.run(RuoYiApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        // 获取端口
        int port = environment.getProperty("server.port", Integer.class);
        log.info("项目启动成功");
        log.info("Swagger地址:{}", "http://localhost:" + port + "/doc.html");
    }
}
